

<?php

include_once("connexion_user2.php") ;

?>


<?php
include_once("connexion.php");
$erreur= "";
if( isset($_POST["envoyer"])){
	$nom = $_POST["nom"];
	$prenom = $_POST["prenom"];
	$date = $_POST["date"];
	$login = $_POST["identifiant"];
	$mdp = $_POST["mdp"];
	$mdp2 = $_POST["confirmmdp"];
	$email = $_POST["email"];
	$email2 = $_POST["confirm"];
	if($mdp!=$mdp2 && (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$email)) && $email!=$email2){ //on vérifie l'intégrité des champs mot de passe et email
		$erreur = "Vérifez les champs mot de passe et E-mail";
	}

	if($erreur==""){
		$mdp = sha1($mdp);
	$query="INSERT INTO User(Id,Nom,Prenom,Email,Naissance,Login,Password,Id_spe) 
		VALUES('',
		'".$nom."', 
		'".$prenom."',
		'".$email."',
		'".$date."',
		'".$login."',
		'".$mdp."',
		'0');";
	$resultat=mysqli_query($bdd,$query);	//on insert les données reçus par post dans les champs de la table
	if($resultat == false){
		echo "Impossible de sauvegarder en Base <br />";
	}
	
	}

}


?>

<!DOCTYPE html>

<html>
	<head>
		<link rel="stylesheet" type="text/css" href="inscription.css"/>
		<title>Formulaire Inscription</title>
		<meta charset="UTF-8" />
		<meta http-equiv="Content-Type" content="charset=UTF-8" />
		 <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">

	 <script src="//code.jquery.com/jquery-1.9.1.js"></script>
  		<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
 		 <link rel="stylesheet" href="/resources/demos/style.css">
  	<script>
  	$(function() {
    $( "#datepicker" ).datepicker();
  });
  </script>

	</head>


	<body>

		<div id="logo">




		</div>

<br />
<br />




		
							<div id="formulaire" >

		<h1>
		Creation d'un Compte :
		</h1>

		<br />

		<p> Veuillez remplir les champs ci-dessous pour vous inscrire.</p> <br /> <br />

		<form action="formulaire_inscription.php" method="post">

		<tr>
			<td> <label for="prenom"> Prénom: </label> <input type="text" name="prenom" id="prenom" value="" ></td> <br /> <br>
		</tr>

		<tr> 
			<td> <label for ="nom"> Nom: </label> <input type="text" name="nom" id="nom" value=""> </td> <br /> <br />
		</tr>

		<tr> 
			<td> <label> Date de naissaince: </label> <input type="text" name="date" id="datepicker" value=""> </td> <br /> <br /> 
		</tr>

		<tr> 
			<td> <label for ="email"> E-mail: </label> <input type="email" name="email" id="email" value=""> </td> <br /> <br />
		</tr>

		<tr> 
			<td> <label> Confirmer E-mail: </label> <input type="email" name="confirm" id="confirm" value=""> </td> <br /> <br /> 
		</tr> 


		<tr> 
			<td> <label for ="identifiant"> Identifiant: </label> <input type="text" name="identifiant" id="identifiant" value=""> </td> <br /> <br />
		</tr>


		<tr> 
			<td> <label for ="mdp"> Mot de passe: </label> <input type="password" name="mdp" id="mdp" value=""> </td> <br /> <br />
		</tr>


		<tr> 
			<td> <label> Confirmer Mot de passe: </label> <input type="password" name="confirmmdp" id="confirmmdp" value=""> </td> <br /> <br />
		</tr>

		<tr>  
			<td> <input type="submit" name="envoyer" id="envoyer" value="Envoyer"> </td> <br /> <br />
		</tr>


		 						</div>



		 	



	</body>

</html>
